import json
class TestClass:
    def __init__(self):
        self.field1 = 'value1'
        self.field2 = 123
        self.field3 = True
        self.field4 = None

class TestClass2:
    def __init__(self):
        self.field1 = 'value1'
        self.field2 = 123
        self.field3 = True    
        self.field4 = None

class TestClass3:
    def __init__(self):
        self.field1 = 'value1'
        self.field2 = 123
        self.field3 = True    
    
if __name__ == '__main__':
    test1 = TestClass()
    test2 = TestClass2()
    test1.field4 = test2
    test2.field4 = test1
    print(json.dumps(test1, default=lambda o : o.__dict__))